//
//  YKHomeTableViewCell.m
//  yuke
//
//  Created by Dejun Liu on 15/1/5.
//  Copyright (c) 2015年 juwan. All rights reserved.
//

#import "YKHomeTableViewCell.h"
#import "YKPlace.h"
#import "YKHomeCollectionViewCell.h"

@implementation YKHomeTableViewCell

- (void)awakeFromNib {
    [self.collectionView registerNib:[UINib nibWithNibName:@"YKHomeCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"cell"];
    self.collectionView.scrollEnabled = YES;
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.listData.count;
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    YKPlace *place = self.listData[indexPath.row];
    YKHomeCollectionViewCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    
    [cell.mImageView sd_setImageWithURL:[NSURL URLWithString:place.pic]];
    cell.mLabel.text = place.name;
    
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    
}

@end
